<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
?>

{if isset($aImages.images) && count($aImages.images) > 0}
    {if isset($aImages.default_image)}
    <img src="{$aImages.default_image}" class="image_preview" width="150px"/>
    <input type="hidden" name="val[image_link]" value="{$aImages.default_image}" id="image_link"/>
    {else}
    <img src="{$aImages.images.0}" class="image_preview" width="150px"/>
    <input type="hidden" name="val[image_link]" value="{$aImages.images.0}" id="image_link"/>
    {/if}
    {foreach from=$aImages.images key=iKey item=sImage}
    <img src="{$sImage}" id="image_preview_{$iKey}" class="image_preview" width="150px" style="display: none;"/>
    {/foreach}
    <div class="link_prev_next">
        <a href="#" class="link_previous" onclick="imagePrevious(); return false;">Prev</a>
        <a href="#" class="link_next" onclick="imageNext(); return false;">Next</a>
    </div>
    <div class="album_select">
        <div>
            <input type="hidden" id="js_album_select" name="val[album_id]"/>
            <a id="js_album_select_link" href="#" onclick="$('#album_select_panel').show();return false;">
                Select an album
            </a>            
        </div>
        <div id="album_select_panel" style="display: none;">
            <div>   
                <input id="album_type" type="hidden" value="{$sAlbumType}" name="album_type"/>
                <input id="album_name" type="text" placeholder="Create album" name="album_name"/>                    
                <input type="submit" class="button" value="Create" 
                       onclick="createAlbum($('#album_name').val(),$('#album_type').val());return false;"/>
                <span id="album_create_form_message"></span>
            </div>
            
            <ul>{if isset($aAlbums) && count($aAlbums) > 0}
                {foreach from=$aAlbums item=aAlbum}
                <li><a ref="{$aAlbum.album_id}" href="#" onclick="selectAlbum(this);return false;">{$aAlbum.title}</a></li>
                {/foreach}{/if}
            </ul>
            
        </div>
    </div>
{else}
    Images not found.
{/if}